package com.my.chapter9;

public class practice1 {
    public static void main(String[] args) {
        Rodent r1 = new Mouse();
        Rodent r2 = new Gerbil();
        Rodent r3 = new Hamster();
        r1.eat();
        r2.eat();
        r3.eat();
    }
}

abstract class Rodent{
    public abstract void eat();
}

class Mouse extends Rodent {
    public void eat(){
        System.out.println("老鼠吃东西");
    }
}

class Gerbil extends Rodent {
    public void eat(){
        System.out.println("鼹鼠吃东西");
    }
}

class Hamster extends Rodent {
    public void eat(){
        System.out.println("大颊鼠吃东西");
    }
}


